package com.example.basic.controller.dto;

import lombok.Data;

import java.io.FileOutputStream;
import java.io.IOException;

@Data
public class TaskDTO implements Runnable{

    private int taskId;
    private FileOutputStream fos;
    private byte[] data;

    @Override
    public void run() {
        System.out.println("Task" + taskId + "is running on thread" + Thread.currentThread().getName());
        try {
            fos.write(data);
        } catch (IOException e) {
            System.out.println("fos write error: {}" + e);
            throw new RuntimeException(e);
        }

    }
}
